package szc.common.code.rule;

import szc.common.code.enums.CodeLineParserEnum;
import szc.common.code.enums.FileTypeEnum;

/**
 * @desc 解析器工厂
 * @author songzc
 * @date 2022/6/18
 */
public abstract class CodeLineParserCreator {

	public static CodeLineParserAbstract createCodeLineParser(CodeLineParserEnum classType, FileTypeEnum fileTypeEnum) {
		switch (classType){
			case NORMAL_CODE_LINE:
				return new NormalCodeLineParser();
			case WHITE_CODE_LINE:
				return new WhiteCodeLineParser();
			case MULTIPLE_END_COMMENT_CODE_LINE:
				return new MultipleEndCommentCodeLineParser(fileTypeEnum);
			case MULTIPLE_START_COMMENT_CODE_LINE:
				return new MultipleStartCommentCodeLineParser(fileTypeEnum);
			case SINGLE_COMMENT_CODE_LINE:
				return new SingleCommentCodeLineParser(fileTypeEnum);
			case MULTIPLE_MIDDLE_COMMENT_CODE_LINE:
				return new MultipleMiddleCommentCodeLineParser();
			default:
				throw new RuntimeException("no class type");
		}
	}
}
